package w83b.w83bOperacionesPaso.w83bIncidencias;

import java.util.ArrayList;
import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.lang.StringUtils;
import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import w83b.w83bBeans.W83bUsuarioXLNetsBean;
import w83b.w83bUtilidadesComunes.W83bClsConstantes;
import es.ejie.frmk.presentacion.operacion.paso.Q70ActionPasoOP;
import es.ejie.frmk.presentacion.sesiondatos.Q70ContextoEJIE;

// TODO: Auto-generated Javadoc
/**
 * The Class W83bTablaAgrupacionesOP.java.
 *
 * @author Deusto Sistemas
 */
public class W83bNoExisteDniDelegadosOPAction extends Q70ActionPasoOP{

	
	protected void processOP(Q70ContextoEJIE contexto, ActionErrors errores, ActionMapping mapping,
			ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		String dnis = (String)request.getParameter("dnis");
		String territorioActa = (String)request.getParameter("territorioActa");
		String anyoActa = (String)request.getParameter("anyoActa");
		String numActa = (String)request.getParameter("numActa");
		
		String[] listadnis = dnis.split("__");
		List arraydnis = new ArrayList();
		
		arraydnis.add(territorioActa);
		arraydnis.add(anyoActa);
		arraydnis.add(numActa);
		
		for(int i=0,size=listadnis.length;i<size;i++){
			if(StringUtils.isNotEmpty(listadnis[i])){
				arraydnis.add(listadnis[i]);
			}
		}
		
		W83bUsuarioXLNetsBean usuario = (W83bUsuarioXLNetsBean)contexto.get(W83bClsConstantes.CONSTANTE_CONTEXTO_USUARIO);
		usuario.setIdioma((String)contexto.get(W83bClsConstantes.CONSTANTE_CONTEXTO_IDIOMA));
		
		arraydnis.add(usuario);
			
		contexto.set("w83bListaDnis",arraydnis);
		
	}

	protected ActionForward processForward(Q70ContextoEJIE contexto, ActionErrors errors, ActionMapping mapping, 
			ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception {
		
		return mapping.findForward("ok");
	}

}
